import backtrader as bt
import datetime
import pandas as pd
import numpy as np


class MyStrategy(bt.Strategy):
    def __init__(self):
        print("init")

    def start(self):
        print("The world call me!")

    def prenext(self):
        print("Not mature")

    def nextstart(self):
        print("Rites of passage")

    def next(self):
        print("a new bar")

    def stop(self):
        print("stop")


cerebro = bt.Cerebro()

brf_ = bt.feeds.GenericCSVData(
    dataname="bitmex_data.csv",
    nullvalue=0.0,
    dtformat=('%Y-%m-%d %H:%M:%S'),
    datetime=0,
    high=2,
    low=3,
    open=1,
    close=4,
    volume=5,
    openinterest=-1
)

cerebro.adddata(brf_)
cerebro.addstrategy(MyStrategy)
cerebro.run()
cerebro.plot(style='candle')
